import requests
from bs4 import BeautifulSoup
#请求的url
url = 'https://fanyi.baidu.com/sug'
#输入的参数
kw = input("请输入要翻译的单词：")
#伪造UA
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
#定义参数
params = {
    "kw": kw
}
#发送Request请求
response = requests.get(url=url,params=params,headers=headers)
response.encoding = "utf-8"
#构造
# soup = BeautifulSoup(response.text,"lxml")
# <div class="dictionary-comment">
# 	<p>  <b>n.</b>
# 		<strong class="dict-comment-mean">
# 			<span>猫</span><span class="dict-margin">;</span>
# 			<span>猫科动物</span>
# 		</strong>
# 	</p>  <p>  <b>vt.</b>
# 	<strong class="dict-comment-mean">
# 		<span>把（锚）吊放在锚架上</span>
# 	</strong>  </p>
# </div>
# result = soup.select('.dictionary-comment>p>strong>')
# print(result)



page_text = response.text
print(page_text)

